﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace bonus.Models
{
	/// <summary>
	/// 用户表
	/// </summary>
	public class User
	{
		/// <summary>
		/// ID
		/// </summary>
		public ObjectId _id { get; set; }

		/// <summary>
		/// 用户编号
		/// </summary>
		public string NO { get; set; }

		/// <summary>
		/// 登录密码
		/// </summary>
		public string Pwd1 { get; set; }

		/// <summary>
		/// 二级密码
		/// </summary>
		public string Pwd2 { get; set; }

		/// <summary>
		/// 金钱上级
		/// </summary>
		public string MUP { get; set; }

		/// <summary>
		/// 经验上级
		/// </summary>
		public string EUP { get; set; }

		/// <summary>
		/// 银行名称
		/// </summary>
		public string BankName { get; set; }

		/// <summary>
		/// 用户名称
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// 持卡人身份证姓名
		/// </summary>
		public string UserName { get; set; }

		/// <summary>
		/// 所属服务中心/公司
		/// </summary>
		public string Cantent { get; set; }

		/// <summary>
		/// 银行卡号
		/// </summary>
		public string BankNO { get; set; }

		/// <summary>
		/// 身份证号
		/// </summary>
		public string Card { get; set; }

		/// <summary>
		/// 余额
		/// </summary>
		public decimal Money { get; set; }

		/// <summary>
		/// 冻结资金
		/// </summary>
		public int Freeze { get; set; }

		/// <summary>
		/// 经验点数
		/// </summary>
		public string EXP { get; set; }

		/// <summary>
		/// 手机号
		/// </summary>
		public string Mobile { get; set; }

		/// <summary>
		/// 用户类型
		/// </summary>
		public int UserType { get; set; }

		#region 类型

		/// <summary>
		/// 用户类型
		/// </summary>
		public class TypeClass
		{
			/// <summary>
			/// 用户
			/// </summary>
			public static readonly int User = 0;

			/// <summary>
			/// 服务中心
			/// </summary>
			public static readonly int CONTENT = 1;

			/// <summary>
			/// 公司
			/// </summary>
			public static readonly int COMPANY = 2;

			/// <summary>
			/// 管理员
			/// </summary>
			public static readonly int ADMIN = 3;

			public static string GetType(int Status)
			{
				string StatusDesc = string.Empty;
				switch (Status)
				{
					case 0:
						StatusDesc = "用户";
						break;
					case 1:
						StatusDesc = "服务中心";
						break;
					case 2:
						StatusDesc = "公司";
						break;
					case 3:
						StatusDesc = "管理员";
						break;
					default:
						StatusDesc = "异常";
						break;
				}
				return StatusDesc;
			}

		}

		#endregion


		/// <summary>
		/// 用户等级
		/// </summary>
		public int Level { get; set; }

		#region 等级

		/// <summary>
		/// 等级
		/// </summary>
		public class LevelClass
		{
			/// <summary>
			/// 学员
			/// </summary>
			public static readonly int STUDENT = 0;

			/// <summary>
			/// 见习
			/// </summary>
			public static readonly int JIANXI = 1;

			/// <summary>
			/// 指导
			/// </summary>
			public static readonly int ZHIDAO = 2;

			/// <summary>
			/// 老师
			/// </summary>
			public static readonly int LAOSHI = 3;

			/// <summary>
			/// 导师
			/// </summary>
			public static readonly int DAOSHI = 4;

			/// <summary>
			/// 院士
			/// </summary>
			public static readonly int YUANSHI = 5;

			/// <summary>
			/// 其他
			/// </summary>
			public static readonly int OTHER = 6;

			public static string GetLevel(int Status)
			{
				string StatusDesc = string.Empty;
				switch (Status)
				{
					case 0:
						StatusDesc = "学员";
						break;
					case 1:
						StatusDesc = "见习";
						break;
					case 2:
						StatusDesc = "指导";
						break;
					case 3:
						StatusDesc = "老师";
						break;
					case 4:
						StatusDesc = "导师";
						break;
					case 5:
						StatusDesc = "院士";
						break;
					case 6:
						StatusDesc = "其他";
						break;
					default:
						StatusDesc = "异常";
						break;
				}
				return StatusDesc;
			}

		}

		#endregion


		/// <summary>
		/// 是否暂停金钱返给
		/// </summary>
		public bool IsMStop { get; set; }

		/// <summary>
		/// 绑定的服务商或公司
		/// </summary>
		public List<string> Bind { get; set; }

		/// <summary>
		/// 是否暂停经验返给
		/// </summary>
		public bool IsEStop { get; set; }

		/// <summary>
		/// 添加时间
		/// </summary>
		[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
		public DateTime AddDT { get; set; }

	}
}